package com.example.workscheduler;

import java.util.Random;


import android.app.Activity;
import android.graphics.Color;
import android.view.Display;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;

public class CalendarPicker {
	Activity activity;
	private LinearLayout headerLayout;
	private String[] header = { "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"

	};

	public CalendarPicker(Activity activity) {
		this.activity = activity;
		headerLayout = new LinearLayout(activity);
		headerLayout.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.FILL_PARENT));
	}

	public LinearLayout createHeader(LinearLayout linearLayout) {
		Display display = activity.getWindowManager().getDefaultDisplay();
		
		int width = display.getWidth();
		
		for (int i = 0; i < header.length; i++) {
			final TextView t = new TextView(activity);
			t.setText(header[i]);
			t.setWidth(width/8);
			t.setGravity(Gravity.CENTER);
			t.setBackgroundColor(Color.GREEN);
			t.setOnClickListener(new View.OnClickListener() {
				
				@Override
				public void onClick(View v) {
					t.setText(t.getText() + "" + new Random().nextInt(100));
				}
			});
			t.setTextSize(t.getWidth()-3);
			linearLayout.addView(t);
			linearLayout.setHorizontalGravity(Gravity.CENTER);
		}
		
		return linearLayout;
	}
}
